/*
 * @Author: your name
 * @Date: 2021-09-01 10:08:16
 * @LastEditTime: 2021-09-01 16:14:34
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\5-javascript\day08\2-正则表达式.js
 */

// var pattern = /abc(d|e)/g;
// var str = "abcc abcd ab abce";
// console.log(pattern.exec(str));
// console.log(pattern.lastIndex);
// console.log(pattern.exec(str));
// console.log(pattern.lastIndex);
// console.log(pattern.exec(str));
// console.log(pattern.lastIndex);

var pattern = /abc(d|e)/g;
var str = "abcc abcd ab abce";
//=== 值和类型
//== 值
while (result = pattern.exec(str)) {
    console.log(result[0]);
}

//获取用户的控制台输入
const readline = require("readline-sync");
var pattern = /abc/i;
var str = readline.question("请输入你要检验的字符串");
console.log(pattern.exec(str));